package com.example.administrator.myapplication;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.ListView;

import java.util.ArrayList;
import java.util.List;

public class MainActivity extends AppCompatActivity {
    ListView mListView;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        List<News> list = new ArrayList<>();
        for (int i = 0; i <20 ; i++) {
            list.add(new News(R.mipmap.mm,"我是标题"+i,"我是内容"+i));
        }
        mListView = (ListView) findViewById(R.id.listView1);
        mListView.setAdapter(new MyAdapterImooc(this,list));
//        myAdapter();
    }

//    private void myAdapter(){
//        List<News> mList = new ArrayList<>();
//        for (int i = 0; i < 20; i++) {
//            News news = new News(R.mipmap.ic_launcher,"新闻的标题"+i,"新闻的概要"+i);
//            mList.add(news);
//        }
//        MyAdapter adapter = new MyAdapter(this,mList);
//        mListView.setAdapter(adapter);
//    }
}
